<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<body>
 <div id="d" class="safkjhsu"></div>
<button type="button" onclick="test()">按钮</button>
<script>
    function test(){
        var d = document.getElementById('d')
          //w3cDOM
        // d.setAttribute('class','abc')
          //获取元素值
        console.log(d.getAttribute('class'))
    }
</script>
</body>
</html>